<?php 
class Map {
	
	public function display() {
		echo '<head>';
		echo 	'<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />';
    	echo 	'<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>';
		echo 	'<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>';
		echo 	'<script type="text/javascript" src="mapscript.js"></script>';
		echo '</head>';
		
		//get the latitude and longitude if available
		if(!isset($_GET['lat']) || !isset($_GET['lng'])) {
			//default value
			$lat = '61.383';
			$lng = '5.867';
		}
		else {
			$lat = $_GET['lat'];
			$lng = $_GET['lng'];
		}
		
		//load map and set location to the current $lat and $lng
		echo '<body onload="load('.$lat.','.$lng.')">';
		echo '<div id="map" style="width: 100%; height: 100%;"></div>';
		echo '</body>';
	}
}
?>